<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">       
<meta name="viewport" content="width=device-width" /> 
   
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
  
    <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css"/>
    <script type="text/javascript" src="jQuery/jquery-2.2.3.min.js"></script>
    <script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<style type="text/css">

</style>
</head>
<body>
  <div id="pageone">
      <div data-role="header" style="justify-content:center;align-items:center;display:-webkit-flex;height:50px;background:#ffffff;">
            <a href="Blog.html" role="button" style="text-decoration:none;background:#ffffff">
                <em style=" font-style:normal;font-weight: normal;color:#868686">返回</em>
            </a>
          <div role="button" style="margin:0 auto;width:70%;background:#ffffff;text-align:center;">
              <em style=" font-style:normal;font-weight: normal;color:#868686">发微博</em>
              <em></em>
          </div>
            <a role="button" style="text-decoration:none;background:#ffffff">
                <em style=" font-style:normal;font-weight: normal;color:#868686">发送</em>
            </a>
      </div>
      
      <div contenteditable="true" style="outline:none;" autofocus>
    
      </div> 
     


<div style="margin :0px auto; width:100%;">

	<input type="file"  name="file" id="doc" multiple="multiple"  style="width:150px;" onchange="setImagePreviews();return false;" accept="image/*" />
<div id="dd" style=" width:100%;"></div>

</div>        
      	
      
      <div data-role="footer"  data-position="fixed" style="height:50px;background:#ffffff;" data-tap-toggle="false">
       <ul class="tool" style="list-style-type: none;">
                <li style="float:left;line-height:50px;width:33%;vertical-align:middle;text-align:center;">
                    <a role="button" style="text-decoration:none;">
                        <em style=" font-style:normal;font-weight: normal;color:#868686">图片</em>
                    </a>
                </li>
                <li style="float:left;line-height:50px;width:33%;vertical-align:middle;text-align:center;">
                    <a role="button" style="text-decoration:none;">
                        <em></em>
                        <em style=" font-style:normal;font-weight: normal;color:#868686">@</em>
                    </a>
                </li>
                <li style="float:left;line-height:50px;width:33%;vertical-align:middle;text-align:center;">
                    <a role="button" style="text-decoration:none;">
                        <em></em>
                        <em style=" font-style:normal;font-weight: normal;color:#868686">表情</em>
                    </a>
                </li>
            </ul>
    </div>                
    
  </div>
<script type="text/javascript">
 

function setImagePreviews() {

    var docObj = document.getElementById("doc");
    var dd = document.getElementById("dd");
    dd.innerHTML = "";
    var fileList = docObj.files;
    for (var i = 0; i < fileList.length; i++) {            
        dd.innerHTML += "<div style='float:left' > <img id='img" + i + "'  /> </div>";
        var imgObjPreview = document.getElementById("img"+i); 
        if (docObj.files && docObj.files[i]) {
            //火狐下，直接设img属性
            imgObjPreview.style.display = 'block';
            imgObjPreview.style.width = '150px';
            imgObjPreview.style.height = '180px';
            //imgObjPreview.src = docObj.files[0].getAsDataURL();
            //火狐7以上版本不能用上面的getAsDataURL()方式获取，需要一下方式
            imgObjPreview.src = window.URL.createObjectURL(docObj.files[i]);
        }
        else {
            //IE下，使用滤镜
            docObj.select();
            var imgSrc = document.selection.createRange().text;
            alert(imgSrc)
            var localImagId = document.getElementById("img" + i);
            //必须设置初始大小
            localImagId.style.width = "150px";
            localImagId.style.height = "180px";
            //图片异常的捕捉，防止用户修改后缀来伪造图片
            try {
                localImagId.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
                localImagId.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgSrc;
            }
            catch (e) {
                alert("您上传的图片格式不正确，请重新选择!");
                return false;
            }
            imgObjPreview.style.display = 'none';
            document.selection.empty();
        }
    }  
    return true;
}

</script>

</body>
</html>